<!--#
layout("/layouts/store.html"){
#-->
<header class="header navbar bg-white shadow">
    <div class="btn-group tool-button">
        <a class="btn btn-primary navbar-btn" href="${base}/platform/self/order/goods/feedback" id="goBack" data-pjax><i class="ti-angle-left"></i>${msg['globals.button.back']}</a>
        <a id="doLink" href="/platform/self/order/goods/feedback" data-pjax></a>
    </div>
    <div class="pull-right">
        <a class="btn btn-primary navbar-btn js-audit"  href="javascript:;" data-pjax>保存回复</a>
    </div>
</header>
<script src="${base!}/assets/common/vendor/city-picker/js/data.86.all.js" type="text/javascript"></script>
<script src="${base!}/assets/common/vendor/city-picker/js/picker.86.js" type="text/javascript"></script>
<div class="content-wrap bg-white">
    <div class="wrapper" style="min-height:500px;top:50px;">
        <div class="panel-body bg-white">
            <form id="auditForm" role="form" class="form-horizontal parsley-form" data-parsley-validate>
                <input type="hidden" name="id" value="${obj.id}"/>
                <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="validate-required-star" style="color: red; display: none;">*</span>回复内容</label>
                    <div class="col-sm-8">
                        <textarea class="form-control" name="storeReplyNote" rows="5"
                                  data-parsley-maxlength="250" data-parsley-required="true">${obj.storeReplyNote}</textarea>
                    </div>
                </div>
            </form>
        </div>

        <div class="panel-body" style="margin-bottom: 35px">
            <input type="hidden" name="id" value="${obj.id}">

            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">订单信息</h3>
                </div>
                <div class="panel-body">
                    <div class="col-md-10 col-md-offset-1">
                        <div class="col-md-4" style="padding: 5px 0px">
                            订单编号:   <span>${obj.orderMain.id}</span>
                        </div>
                        <div class="col-md-4" style="padding: 5px 0px">
                            订单来源:   <span>${@com.aebiz.app.order.modules.models.em.OrderSourceEnum.getValue(obj.orderMain.orderSrc)}</span>
                        </div>
                        <div class="col-md-4" style="padding: 5px 0px">
                            下单时间:   <span><!--#if(!isEmpty(obj.orderMain.orderAt)){#-->${@date.getDate(obj.orderMain.orderAt)} <!--#}#--></span>
                        </div>

                        <div class="col-md-4" style="padding: 5px 0px">
                            会员昵称:   <span>${obj.accountInfo.nickname}</span>
                        </div>
                        <div class="col-md-4" style="padding: 5px 0px">
                            用户名:   <span>${obj.accountUser.loginname}</span>
                        </div>
                        <div class="col-md-4" style="padding: 5px 0px">
                            手机号码:   <span>${obj.accountUser.mobile}</span>
                        </div>
                        <div class="col-md-12" style="padding: 5px 0px">
                            商品名称:   <span>${obj.goodsMain.name}&nbsp;${obj.goodsProduct.name}</span>
                        </div>
                    </div>
                </div>
            </div>

            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">评价信息</h3>
                </div>
                <div class="panel-body">
                    <div class="col-md-10 col-md-offset-1">
                        <div class="col-md-12" style="padding: 5px 0px;">
                            是否对外显示:   <span>${obj.feedOpen ? "对外显示" : "不对外显示"}</span>
                        </div>
                        <div class="col-md-12" style="padding: 5px 0px;">
                            商品评分:   <span><input name="appScore" readonly value="${obj.appScore}" type="number" class="rating" min=0 max=5 step=0.5 data-size="xs" ></span>
                        </div>
                        <div class="col-md-12" style="padding: 5px 0px">
                            评价时间:   <span><!--#if(!isEmpty(obj.feedAt)){#-->${@date.getDate(obj.feedAt)} <!--#}#--></span>
                        </div>
                        <div class="col-md-12" style="padding: 5px 0px">
                            评价内容:   <span>${obj.feedNote}</span>
                        </div>
                    </div>
                </div>
            </div>

            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">评价图片</h3>
                </div>
                <div class="panel-body">
                    <div class="col-md-10 col-md-offset-1">
                        <!--# if(isEmpty(obj.feedImage)){ #-->
                        <span>暂无图片</span>
                        <!--# } #-->
                        <!--# var imageArr = strutil.split(obj.feedImage, ","); #-->
                        <!--# for(var image in imageArr){ #-->
                        <div id="img" class="div-img-album">
                            <div class="col-sm-6 col-md-3">
                                <a href="#" class="thumbnail">
                                    <img id="${image}"  src="${image}">
                                </a>
                            </div>
                        </div>
                        <!--#} #-->
                    </div>
                </div>
            </div>

            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">评价回复信息</h3>
                </div>
                <div class="panel-body">
                    <div class="col-md-10 col-md-offset-1">
                        <div class="col-md-12" style="padding: 5px 0px">
                            回复时间:   <span><!--#if(!isEmpty(obj.storeReplyAt)){#-->${@date.getDate(obj.storeReplyAt)} <!--#}#--></span>
                        </div>
                        <div class="col-md-12" style="padding: 5px 0px">
                            回复内容:   <span>${obj.storeReplyNote}</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div id="dialogFeedOpen" class="modal fade bs-modal-sm" tabindex="-2" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">确认操作</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-xs-12" id="fendOpenConfrimInfo">

                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">${msg['globals.button.cancel']}</button>
                <button id="okFeedOpen" type="button" class="btn btn-primary" data-loading-text="操作中..">${msg['globals.button.confirm']}</button>
            </div>
        </div>
    </div>
</div>

<style>
    table .s-input{margin: auto;}
    table,table.s-table tr td,table tr th{border: 1px solid #ddd;text-align: center;vertical-align: middle;}
    .star-rating{
        display: inline-block !important;
    }
</style>

<script>
    $(document).ready(function () {
        $("input[name='appScore']").rating();
    });

    //审核
    $(".js-audit").click(function () {
        var $form = $("#auditForm");
        if (!$form.parsley().validate()) {
            return false;
        }
        var storeReplyNote = $("textarea[name=storeReplyNote]", $form).val();
        $.post("${base!}/platform/self/order/goods/feedback/replayDo/${obj.id}", $.param({storeReplyNote: storeReplyNote}, true), function (data) {
            if (data.code == 0) {
                Toast.success(data.msg);
                $("#doLink").trigger("click");
            } else {
                Toast.error(data.msg);
            }
        }, "json");
    });
</script>
<!--#}#-->